﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using Yala.Models.UserProfiles;

namespace Yala.DataAccess.Common.EF.Mappings {
    public class UserProfileConfiguration : EntityTypeConfiguration<UserProfile> {
        public UserProfileConfiguration() {
            ToTable("UserProfiles");
            HasKey(x => x.Id).Property(x => x.Id).HasColumnName("UserId").IsRequired();
            Property(x => x.FirstName).HasColumnName("FirstName");
            Property(x => x.MiddleName).HasColumnName("MiddleName");
            Property(x => x.LastName).HasColumnName("LastName");
            HasRequired(x => x.User).WithRequiredPrincipal(x => x.UserProfile);
        }
    }
}
